# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=deepin-printer
pkgver=0.9.16
pkgrel=1
pkgdesc='Printer configuration project for DDE'
arch=('loong64' 'x86_64')
url="https://github.com/linuxdeepin/dde-printer"
license=('GPL3')
depends=('cups' 'deepin-qt5integration' 'smbclient')
makedepends=('gtest' 'qt5-tools')
groups=('deepin-extra')
source=("https://github.com/linuxdeepin/dde-printer/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('86a5b3268fd5a088f1f40b1cddf3aac8ffe95e44c31f9e540907f1cb56af79b210fc9ce8e77131465c5cff35c78bc2a807e672d357c92e8c151e40e80c8fcc11')

prepare() {
  cd dde-printer-$pkgver
  sed -i '$aOnlyShowIn=Deepin' src/Printer/platform/linux/dde-printer.desktop

  # https://github.com/linuxdeepin/dde-printer/issues/4
  sed -i '/#include <strings.h>/a #include <stdexcept>' src/cppcups/cupssnmp.cpp
}

build() {
  cd dde-printer-$pkgver
  qmake-qt5 PREFIX=/usr
  make
}

package() {
  cd dde-printer-$pkgver
  make INSTALL_ROOT="$pkgdir" install
}
